<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 86188
  Date: 2019/1/16
  Time: 16:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改页面</title>
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <script type="text/javascript" src="/static/layuiadmin/layui/layui.js"></script>
    <script type="text/javascript" src="/static/js/jquery-3.3.1.js"></script>
    <style type="text/css">
        .layui-textarea {
            min-height: 40px;
            height: 40px;
            line-height: 17px;
            padding: 10px 9px;
            resize: vertical
        }
    </style>
</head>
<body>
<form class="layui-form" id="myform">
    <table class="layui-table" style="text-align: center">
        <tr>
            <td width="100px">
                机构时间
            </td>
            <td>
                <input type="text" name="mid" id="mid" hidden="hidden" value="${m.mid}">
                <textarea class="layui-textarea" name="mtime" id="test5" lay-verify="required" cols="20" rows="1" readonly="readonly">${m.mtime}</textarea>
            </td>
        </tr>
        <tr>
            <td>机构编号</td>
            <td>
                <textarea class="layui-textarea" name="mnumber" id="mnumber" lay-verify="required" cols="20" readonly="readonly" rows="1">${m.mnumber}</textarea>

            </td>
        </tr>
        <tr>
            <td>机构类型</td>
            <td>
                <select name="mtype" id="mtype" lay-verify="required" lay-search="">
                    <c:if test="${m.mtype == '省级机构'}">
                        <option value="省级机构" selected="selected">省级机构</option>
                        <option value="市级机构">市级机构</option>
                        <option value="县级机构">县级机构</option>
                        <option value="镇级机构">镇级机构</option>
                    </c:if>
                    <c:if test="${m.mtype == '市级机构'}">
                        <option value="省级机构">省级机构</option>
                        <option value="市级机构" selected="selected">市级机构</option>
                        <option value="县级机构">县级机构</option>
                        <option value="镇级机构">镇级机构</option>
                    </c:if>
                    <c:if test="${m.mtype == '县级机构'}">
                        <option value="省级机构">省级机构</option>
                        <option value="市级机构">市级机构</option>
                        <option value="县级机构" selected="selected">县级机构</option>
                        <option value="镇级机构">镇级机构</option>
                    </c:if>
                    <c:if test="${m.mtype == '镇级机构'}">
                        <option value="省级机构">省级机构</option>
                        <option value="市级机构">市级机构</option>
                        <option value="县级机构">县级机构</option>
                        <option value="镇级机构" selected="selected">镇级机构</option>
                    </c:if>
                </select>
            </td>
        </tr>
        <tr>
            <td>机构名称</td>
            <td>
                <textarea class="layui-textarea" name="mname" id="mname" lay-verify="required" cols="20" rows="1" >${m.mname}</textarea>
            </td>
        </tr>
        <tr>
            <td>负责地区</td>
            <td>
                <textarea class="layui-textarea" name="mregion" id="mregion" lay-verify="required" cols="20" rows="1" >${m.mregion}</textarea>
            </td>
        </tr>
        <tr>
            <td>添加人</td>
            <td>
                <textarea class="layui-textarea" name="madd" id="madd" lay-verify="required" cols="20" rows="1" >${m.madd}</textarea>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="editButton">修改</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </td>
        </tr>
    </table>
</form>
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        //监听提交
        form.on('submit(editButton)', function (data) {
            $.ajax({
                url: "updateMechanism",
                type: "post",
                datatype: "json",
                data: {
                    "mechanism": JSON.stringify(data.field)
                },
                success: function (data) {
                    //获取窗口索引
                    var index = parent.layer.getFrameIndex(window.name);
                    //关闭窗口
                    parent.layer.close(index);
                    parent.layer.msg(data.msg);
                }
            });
            return false;
        });
    });
</script>
<script>
    layui.use('laydate',function () {
        var laydate = layui.laydate;
        //日期选择
        laydate.render({
            elem: '#test5'
            ,type: 'datetime'
        });
    })
</script>
</body>
</html>